<template>
  <h1>猜数字练习</h1>
  <input type="text" v-model="v">
  <button @click="f">猜数字</button>
</template>
<script setup>
  import {ref} from "vue";
  const res = ref(Math.floor(Math.random()*100)+1);
  const v = ref('');
  const f = () => {
    if (v.value>res.value){
      alert('猜大了')
    }else if(v.value<res.value){
      alert('猜小了')
    }else {
      alert('猜对了')
    }
  }
</script>

<style scoped>

</style>